/**************************************************************************************
*
*	Copyright (C) 2010 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	Tokenizer.h
*
*	Description -	Handy utility for taking in strings and braking them down by 
*					spacing(tokens).
*
*	Comments	-	TODO: We can optionally enter a list of characters to stop and tokenize
*						instead of the default space and null.
*
*	Modification History:
*			Name			   Date					Description
*			MrCodeSushi	-	09/21/2012	-	Creation of this file
**************************************************************************************/
#ifndef _PSX_TOKENIZER_H_
#define _PSX_TOKENIZER_H_

#include "PulseSTD.h"
#include "String.h"
#include "Array.h"

namespace Pulse
{

	class Tokenizer
	{
	public:

		static BOOL NextToken( const CHAR *pParametersInput, UPOS_T *pMarker, String *pTokenToStore );

	};

	// Version 2.
	class Tokenizer2
	{
	public:

		Tokenizer2( const CHAR *pParameters = PSX_NULL );

		void AddSeparator( const CHAR separator );

		void ClearSeparators( void );

		void SetNewInpuParameters( const CHAR *pParameters );

		BOOL NextToken( String *pTokenToStore );

		void ResetMarker( void ) { m_marker = 0; }

	private:

		typedef Array<CHAR> SeparatorList;

		const CHAR *m_pParamInput;
		UPOS_T m_marker;
		SeparatorList m_separators;

	};
}

#endif /* _PSX_TOKENIZER_H_ */
